import 'package:flutter/material.dart';

import '../res/colors.dart';

class ThemeDialog extends Dialog {
  final String? title; //标题
  final String? content; //内容
  final void Function()? cancelCallBack;
  final void Function()? confirmCallBack;

  ThemeDialog(
      {required this.title,
      required this.content,
      required this.cancelCallBack,
      required this.confirmCallBack});

  @override
  Widget build(BuildContext context) {
    return AlertDialog(
      content: Container(
        margin: EdgeInsets.only(left: 40, right: 40, top: 50, bottom: 50),
        color: Colors.white,
        child: Column(
          children: [
            Container(
              alignment: Alignment.centerLeft,
              padding: EdgeInsets.symmetric(vertical: 20, horizontal: 20),
              child: const Text(
                "切换主题",
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 14,
                    color: YColors.color_666),
              ),
            ),
            Container(
              // width: MediaQuery.of(context).size.width * 0.8,
              // height: MediaQuery.of(context).size.height * 0.6,
              child: ListView.builder(
                  itemCount: YColors.themeColor.length,
                  itemBuilder: (context, i) {
                    return GestureDetector(
                      child: Container(
                        padding:
                            EdgeInsets.symmetric(horizontal: 10, vertical: 20),
                        margin: EdgeInsets.symmetric(vertical: 20),
                        decoration: BoxDecoration(
                          color: YColors.themeColor[i]['primaryColor'],
                        ),
                      ),
                    );
                  }),
            ),
          ],
        ),
      ),
    );
  }
}
